#####################################################################
# Product:      KnowledgeEngine (Plone Edition)
#
# File:         EmptyGroupProviderService.py
#
# Copyright:    Copyright (c) 2004, Faulkner Technologies
#
# Author:       Brian Oliver
#
# Description:  Defines a GroupProviderService that does not
#               return groups.  This provider is ideal for
#               situations where groups aren't used.
#
# See Also:     Service, GroupProviderService
#####################################################################

#####################################################################
## KnowledgeEngine Library Imports
from Products.KnowledgeEngine.Common import *
from Products.KnowledgeEngine.Core import *
from Products.KnowledgeEngine.GroupProviderService import GroupProviderServiceInfo, GroupProviderService

#####################################################################
## Zope Library Imports
# (none)

#####################################################################
## Zope Library Imports
# (none)
 
#####################################################################
## Python Library Imports
# (none)

#####################################################################
## EmptyGroupProviderService Class Definition
class EmptyGroupProviderServiceInfo(GroupProviderServiceInfo):
    """
        Defines the the group provider service meta-information
    """
    
    #---------------------------------------------------------------#
    
    def getClassName(self):
        """
            Returns the name of the class for which 
            we are providing information.
        """
        return 'EmptyGroupProviderService'


    #---------------------------------------------------------------#

    def getDisplayName(self):
        """
            Return a friendly name for the class instances
            (this is used for displaying in lists etc)
        """
    
        return "KnowledgeEngine: Empty Group Provider Service"
        
    #---------------------------------------------------------------#

    def getServiceName(self):
        """
            ABSTRACT: Return the lookup-identity.
            
            This method must be overriden to provide a unique service name
            (this name is used to set the zope id of the service
            when created)
        """
        
        return "knowledgeengine_groupproviderservice"

#####################################################################
## EmptyGroupProviderService Class Definition
class EmptyGroupProviderService(GroupProviderService):
    """
        Defines a tool that may be used to manage Knowledge Engine
        groups
    """

    #---------------------------------------------------------------#

    #ABSTRACT TRANSIENT: a ServiceInfo implementation instance to provide info about this service
    _SERVICEINFO = EmptyGroupProviderServiceInfo()

    #---------------------------------------------------------------#

    def __init__(self):
        """
            Constructor for the object
        """
        
        #this is a stateless mix-in
        pass
        
    #---------------------------------------------------------------#

    def getGroup(self, groupIdentity):
        """
            Returns a Knowledge Engine Group instance for the 
            group with the provided identity.
            
            The groupIdentity is a unique string that identifies the group
            with for the service implementation.  Typically this is
            the group name (but is actually implementation dependant)
            
            Returns None if the group is unknown.
            
            RETURN TYPE: Group
        """
        
        return None

    #---------------------------------------------------------------#

    def getGroups(self):
        """
            Returns a list of groups that this service provides
            
            RETURN TYPE: [Group]
        """
        
        return []

    #---------------------------------------------------------------#

    def getParentGroupsForActor(self, actorIdentity):
        """
            Returns a list of the immediate parent groups that the
            specified actor belongs to.
            
            RETURN TYPE: [Group]
        """
        
        return []

    #---------------------------------------------------------------#

    def getGroupsForActor(self, actorIdentity):
        """
            Returns a list of all of the groups that the
            specified actor belongs to.
            
            RETURN TYPE: [Group]
        """
        
        return []

    #---------------------------------------------------------------#

#####################################################################
## Class Initialisation
# (none)

# Register Service Information with the Knowledge Engine
registerServiceClass(EmptyGroupProviderService)
